import axios from "./axios";
import qs from 'qs'

export function getStockInList({warehouse, belongModule, stockYear, stockMonth, pageNum, exploit, timeOutStatus, shipNumber, stockInNum}) {
    return axios.post('/optimization_inventory/manage/stock_in_list.do', qs.stringify({
        pageSize: 100,
        warehouse,
        belongModule,
        stockYear,
        stockMonth,
        pageNum,
        exploit,
        timeOutStatus,
        shipNumber,
        stockInNum
    })).then(res => Promise.resolve(res.data))
}

export function stockIn(stockIn) {
    const data = qs.stringify(stockIn);
    return axios.post('/optimization_inventory/manage/stock_in.do', data).then(res => Promise.resolve(res.data))
}


export function saveStockIn(stockIn) {
    const data = qs.stringify(stockIn);
    return axios.post('/optimization_inventory/manage/save_stock_in.do', data).then(res => Promise.resolve(res.data))
}

export function getStockInDetail(stockInId) {
    return axios.post('/optimization_inventory/manage/stock_in_detail.do', qs.stringify({stockInId})).then(res => Promise.resolve(res.data))
}

export function getStockInRecord(stockInId) {
    return axios.post('/stock_change_record/show_stock_in_detail.do', qs.stringify({stockInId})).then(res => Promise.resolve(res.data))
}

//  IEL stockIn 获取供应商借口
export function getSupplier() {
    // /supplier/manage/get_supplier_list.do?belongModule=
    return axios.get('/supplier/manage/get_supplier_list.do').then(res => Promise.resolve(res.data))
}
// 获取配件的入库信息分页
export function getStockInInfo(stock) {
    return axios.post('/optimization_inventory/manage/show_all_stock_in_by_parts_id.do\n',qs.stringify(stock))
        .then(res => Promise.resolve(res.data))
}
// 根据仓库判断库存
export function getWarehouseStock({partsId,belongModule,warehouse}) {
    return axios.post('/optimization_inventory/manage/check_inventory_enough_or_not.do',qs.stringify({partsId,belongModule,warehouse}))
        .then(res => Promise.resolve(res.data))
}